﻿<!--
//return Request Url
function mRequest(strName)
{
 var strHref = window.document.location.href;
 var intPos = strHref.indexOf("?");
 var strRight = strHref.substr(intPos + 1);

 var arrTmp = strRight.split("&");
 for(var i = 0; i < arrTmp.length; i++)
 {
  var arrTemp = arrTmp[i].split("=");

  if(arrTemp[0].toUpperCase() == strName.toUpperCase()) return arrTemp[1];
 }
 return "";
}
//Clear Items of DropDownList
function ddl_Clear( ddl_name )
{
	var obj = document.getElementById(ddl_name);
	for(var i = obj.options.length - 1;i >= 0;i--)
	{
		obj.options[i] = null;
	}
}
//Bind Selected Value
function ddl_selected(ddl_name,match_val,isValue)
{
	var obj = document.getElementById(ddl_name);
	for( var i = 0; i < obj.options.length; i++ )
	{
		var matchobj = obj.options[i].value;
		if(!isValue)
		{
			matchobj = obj.options[i].Text;
		}
		if(match_val == matchobj)
		{
			obj.options[i].selected = "true";
		}
	}
}
//DataBind to DropDownList
function ddl_Bind(ddl_name,bindData)
{ 	
	var obj = document.getElementById(ddl_name);

	for( var i = 0;i < bindData.length; i++ )
	{
		if(i == 0)
		{
			if(bindData[i][0] != "")
			{
				obj.add( new Option( bindData[i][0],bindData[i][1] ) );
			}
		}
		else
		{
			obj.add( new Option( bindData[i][0],bindData[i][1] ) );
		}
	}
}
//Relating Next DropDownList
function ddl_changed( ddl_name,keywords,ddl_data )
{		
	var obj = document.getElementById(ddl_name);
	var m = 0;		
	ddl_Clear(ddl_name);
	for( var i = 0; i < ddl_data.length; i++ )
	{		
		if( ddl_data[i][2] == keywords )
		{
			obj.options[m] = ( new Option( ddl_data[i][0],ddl_data[i][1] ) );
			m = m + 1;
		}		
	}
}

function delspace(findstr)
{	
    var myfind = findstr;    
    for( var i = 0; i < findstr.length; i++ )
    {
	    var myfind = myfind.replace(" ","");
    }
    return myfind;
}
//all checkBox checked
function all_chkBox_check(checkbool)
{	
	var obj = document.getElementsByName("check_class");

	for(var i = 0; i < obj.length;i++)
	{
		obj[i].checked = checkbool;
	}
}

//提交表单
function PostForm(FormName,PostPage,Msg,Target)
{
    if(window.confirm(Msg))
    {
        var obj_form = document.getElementById(FormName); 
        var vs = document.getElementById("__VIEWSTATE");

        if(vs != null) { vs.value = ""; }
        obj_form.target = Target;
	    obj_form.action = PostPage;
	    obj_form.method = "post";
	    obj_form.submit();	    
    }
}
//删除
function DeleteToSelected(FormName,DelPage,Title)
{    
    PostForm(FormName, DelPage, "删除确认", "_self");    
}
//其它
function SelectedForOther(FormName, PostPage, Title, Target)
{
    PostForm(FormName, PostPage, Title, Target);
}

function AreYouSure(msg)
{
    if(window.confirm(msg))
    {
        return true;
    }
    return false;
}

//隐藏或显示对象
function hide_obj(objstr)
{
	var obj = document.getElementById(objstr);
	obj.style.display=(obj.style.display =='none')?'':'none';
}
	
/////////////////////////////////////////////////////
function open_Window(URL,W,H,paramter)
{
    var size = WindowSize(W,H);	
		var vReturn = window.open(URL,paramter,size);
	
}
function WindowSize(width,height)
{
    return "toolbar=0,status=0,menubar=0,scrollbars=0,resizable=0,width=" + width + ",height=" + height;
}
////////////////////////////////////////////////////// 
function open_Dialog(URL,W,H,paramter)
{
	var size = DialogSize(W,H);	
	var vReturn = window.showModalDialog(URL,paramter,size);
	
	//get value
	if( typeof(vReturn) != "undefined" && vReturn != "undefined" )
	{			
		return vReturn;
	}	
	return "";
}

function DialogSize(width,height)
{
	return "dialogHeight: " + height + "px;dialogWidth: " + width + "px;status:no;scroll:no;help:no;edge:sunken;";
}
/////////////////////////////////////////////////////////////
function open_Modeless(URL,W,H,paramter)
{
    var size = ModelessSize(W,H);    
		var vReturn = window.showModelessDialog(URL,paramter,size);
	
	//get value
	if( typeof(vReturn) != "undefined" && vReturn != "undefined" )
	{			
		return vReturn;
	}	
	return "";
}
function ModelessSize(width,height)
{
    return "dialogWidth:" + width + "px;dialogHeight:" + height + "px;edge: Raised; center: Yes; help: 0; resizable: 0; status: 0;";
}
////////////////////////////////////////////////////////////

function OnSaving(FrmURL)
{
    var SavingWindow = "SavingWindow";
    var SavingURL = "Saving.htm";
    
    if( typeof(FrmURL) != "undefined" && FrmURL != "" )
    {
        SavingURL = FrmURL;
    }
    
    //如果正在保存
    open_Modeless(SavingURL,150,100,SavingWindow);    
}


//获取代理对象(角色名称)
function GetCharacter(AgentName)
{ 
  try 
  { 
    //实例Agnet对象容器(对象版本)
    var Chars = new ActiveXObject("Agent.Control.2"); 
    //打开连接
    Chars.Connected = true; 
    //加载角色对象(加载代号，文件(相对，绝对)),允许加载多个
    Chars.Characters.Load(AgentName, AgentName + ".acs");
    var _Char = Chars.Characters.Character(AgentName);
    //显示文字的模式,下面的编号支持中文空格等待
    _Char.LanguageID = 0x409;
    return _Char;
  } 
  catch (err) 
  { 
    return null; 
  } 
} 

//-->